package com.scopionstudio.network;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;

public class NetWork {
	private Context mContext;
	public NetWork(Context context){
		this.mContext = context;
	}
	public boolean isOnline() {
	    ConnectivityManager mConnectManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
	    if(mConnectManager !=null){
	    	
	    	NetworkInfo[] mInfo = mConnectManager.getAllNetworkInfo();
	    	if(mInfo != null){
	    		for(int i = 0 ; i< mInfo.length ; i++){
	    			if(mInfo[i].getState() == State.CONNECTED){
	    				return true;
	    			}
	    			
	    		}
	    	}
	    }
    		return false;
	}
}
